package com.xuecheng.content.feignclient;

import com.xuecheng.content.model.po.CourseIndex;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author 陈竞超
 * @version 1.0
 * @qq 2250537249
 */
@Slf4j
@Component
public class SearchServiceClientFallbackFactory implements FallbackFactory<SearchServiceClient> {
    @Override
    public SearchServiceClient create(Throwable throwable) {

        return courseIndex -> {
            throwable.printStackTrace();
            log.debug("调用搜索发生熔断走降级方法,熔断异常:", throwable.getMessage());

            return false;
        };
    }
}

